package dynamicProgramming;

public class tribonacci {
    public int tribonacci(int n) {
        int a=0;int b=1;int c=1;int d=a+b+c;

        if(n==0) return 0;
        if(n==1||n==2) return 1;
        for(int i=0;i<n-3;i++){
            a=b;
            b=c;
            c=d;
            d=a+b+c;
        }
        return d;
    }
}
